#ifndef __MRENDER_QUEUE_GROUP_H__
#define __MRENDER_QUEUE_GROUP_H__

#include <map>
#include "MIteratorWrapper.h"
#include "MRenderPriorityGroup.h"
#include "MRenderQueue.h"

class CMRenderQueue;
class CMTechnique;


class CMRenderQueueGroup
{
	//
	// typedef 
	//

public:

	//		typedef std::map<UINT16 , RenderPriorityGroup* , std::less<UINT16> > PriorityMap;
	typedef std::map<unsigned int , CMRenderPriorityGroup*> PriorityMap;
	typedef MapIterator<PriorityMap>                PriorityMapIterator;

	//
	// method 
	//

public:

	// constructor
	CMRenderQueueGroup( CMRenderQueue* pQueue , RenderQueueGroupID eGroupID );

	// destructor
	~CMRenderQueueGroup( void );

	// Get an iterator for browsing through child contents.
	PriorityMapIterator GetIterator( void )
	{
		return PriorityMapIterator( m_PriorityGroups.begin() , m_PriorityGroups.end() );
	}

	// Clears this group of renderables. 
	void Clear( bool bDestroy = false );

	// Add a renderable to this group, with the given priority.
	void AddRenderable( CMRenderable* pRenderable , CMTechnique* pTechnique , unsigned int uiPriority );


	//
	// attribute 
	//	

protected:

	// render queue
	CMRenderQueue* m_pRenderQueue;

	// group ID
	RenderQueueGroupID m_eGroupID;

	// Map of RenderPriorityGroup objects
	PriorityMap m_PriorityGroups;
};


#endif